package net.jueb.frameworkDemo.orm.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import net.jueb.frameworkDemo.orm.enums.RoleSexEnum;
import net.jueb.frameworkDemo.orm.enums.RoleStatusEnum;

@Document(collection="roles")
public class Role implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3252807187756373227L;
	
	/**
	 *使用mongo id 也可以去掉
	 */
	@Id
	private ObjectId _id;
	
	/**
	 * 角色ID
	 */
	private long id;
	
	/**
	 * 用户ID
	 */
	private String uid;
	/**
	 * 角色名
	 */
	private String name;
	/**
	 * 用户来源
	 */
	private String pn;
	/**
	 * 角色金钱
	 */
	private long money;
	/**
	 * 角色钻石
	 */
	private long diamond;
	/**
	 * 话费
	 */
	private int phoneMoney;
	/**
	 *当前等级
	 */
	private int level;
	/**
	 * 当前等级人物经验
	 */
	private long exp;
	/**
	 * 累计充值金额
	 */
	private int rechargeAmount;
	
	/**
	 * 角色性别
	 */
	private RoleSexEnum sex;
	
	/**
	 * 绑定密码
	 */
	private String pwd;
	/**
	 * 电话
	 */
	private String cellPhone;
	/**
	 * 状态
	 */
	private RoleStatusEnum status;
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	/**
	 * 最后一次登陆时间
	 */
	private Date lastLogin;
	
	/**
	 * 头像
	 */
	private String faceIcon="";
	
	private boolean isRobot;
	
	/**
	 * 最大倍率Id
	 */
	private int maxBetId;
	/**
	 * 当前炮塔
	 */
	private int currentCannon;
	/**
	 * 拥有的炮塔ID
	 */
	private Set<Integer> cannons=new HashSet<Integer>();
	/**
	 * 月卡到期时间(判断天,时分秒忽略,如果时间为2016-2-3 12:20:11,则2016-2-3整天都有效)
	 */
	private long monthCardTime;
	/**
	 * 最后一次月卡领取时间
	 */
	private long lastMonthCardTime;
	public Role() {
		createTime=new Date();
		lastLogin=new Date(createTime.getTime());
		status=RoleStatusEnum.Enable;
		sex=RoleSexEnum.undefine;
		maxBetId=1;
		level=1;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPn() {
		return pn;
	}

	public void setPn(String pn) {
		this.pn = pn;
	}

	public long getMoney() {
		return money;
	}

	public void setMoney(long money) {
		this.money = money;
	}

	public long getDiamond() {
		return diamond;
	}

	public void setDiamond(long diamond) {
		this.diamond = diamond;
	}
	
	public int getPhoneMoney() {
		return phoneMoney;
	}

	public void setPhoneMoney(int phoneMoney) {
		this.phoneMoney = phoneMoney;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public long getExp() {
		return exp;
	}

	public void setExp(long exp) {
		this.exp = exp;
	}

	public int getRechargeAmount() {
		return rechargeAmount;
	}

	public void setRechargeAmount(int rechargeAmount) {
		this.rechargeAmount = rechargeAmount;
	}
	
	public RoleSexEnum getSex() {
		return sex;
	}

	public void setSex(RoleSexEnum sex) {
		this.sex = sex;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getCellPhone() {
		return cellPhone;
	}

	public void setCellPhone(String cellPhone) {
		this.cellPhone = cellPhone;
	}

	public RoleStatusEnum getStatus() {
		return status;
	}

	public void setStatus(RoleStatusEnum status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}

	public String getFaceIcon() {
		return faceIcon;
	}

	public void setFaceIcon(String faceIcon) {
		this.faceIcon = faceIcon;
	}

	public boolean isRobot() {
		return isRobot;
	}

	public void setRobot(boolean isRobot) {
		this.isRobot = isRobot;
	}

	public int getMaxBetId() {
		return maxBetId;
	}

	public void setMaxBetId(int maxBetId) {
		this.maxBetId = maxBetId;
	}

	public int getCurrentCannon() {
		return currentCannon;
	}

	public void setCurrentCannon(int currentCannon) {
		this.currentCannon = currentCannon;
	}

	public Set<Integer> getCannons() {
		return cannons;
	}

	public void setCannons(Set<Integer> cannons) {
		this.cannons = cannons;
	}

	public long getMonthCardTime() {
		return monthCardTime;
	}

	public void setMonthCardTime(long monthCardTime) {
		this.monthCardTime = monthCardTime;
	}

	public long getLastMonthCardTime() {
		return lastMonthCardTime;
	}

	public void setLastMonthCardTime(long lastMonthCardTime) {
		this.lastMonthCardTime = lastMonthCardTime;
	}

	@Override
	public String toString() {
		return "Role [_id=" + _id + ", id=" + id + ", uid=" + uid + ", name=" + name + ", pn=" + pn + ", money=" + money
				+ ", diamond=" + diamond + ", phoneMoney=" + phoneMoney + ", level=" + level + ", exp=" + exp
				+ ", rechargeAmount=" + rechargeAmount + ", sex=" + sex + ", pwd=" + pwd + ", cellPhone=" + cellPhone
				+ ", status=" + status + ", createTime=" + createTime + ", lastLogin=" + lastLogin + ", faceIcon="
				+ faceIcon + ", isRobot=" + isRobot + ", maxBetId=" + maxBetId + ", currentCannon=" + currentCannon
				+ ", cannons=" + cannons + ", monthCardTime=" + monthCardTime + ", lastMonthCardTime="
				+ lastMonthCardTime + "]";
	}
}
